<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%--JSTL标签库--%>
<html lang="zh-CN">
<head>
    <title>修改个人信息</title>
    <style>
        body {
            background-image: url("./img/water.jpg");
            background-size: cover;
        }
        /*table {
            background-color: #FFFFFF; !*设置背景色为白色*!
        }*/
    </style>
    <style type="text/css">
    td, th {
        /*color: white;!*字体设置为白色*!*/
        text-align: center;
    }
</style>
    <!-- 指定字符集 -->
    <meta charset="utf-8">
    <!-- 使用Edge最新的浏览器的渲染方式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- viewport视口：网页可以根据设置的宽度自动进行适配，在浏览器的内部虚拟一个容器，容器的宽度与设备的宽度相同。
    width: 默认宽度与设备的宽度相同
    initial-scale: 初始的缩放比，为1:1 -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->

    <!-- 1. 导入CSS的全局样式 -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <!-- 2. jQuery导入，建议使用1.9以上的版本 -->
    <script src="js/jquery-2.1.0.min.js"></script>
    <!-- 3. 导入bootstrap的js文件 -->
    <script src="js/bootstrap.js"></script>

</head>
<body>
<div class="container" style="width: 400px;">
    <h3 style="text-align: center;">修改个人信息</h3>
    <form action="${pageContext.request.contextPath}/updateEmployee" method="post">

        <div class="form-group">
            <label for="employeeId">编号：</label>
            <input type="text" class="form-control" id="employeeId" name="employeeId"    placeholder="请输入编号" />
        </div>

        <div class="form-group">
            <label for="employeeName">姓名：</label>
            <input type="text" class="form-control" id="employeeName" name="employeeName"   placeholder="请输入姓名" />
        </div>

        <div class="form-group">
            <label for="employeePassword">密码：</label>
            <input type="password" class="form-control" id="employeePassword"  name="employeePassword"   placeholder="请输入密码" />
        </div>

        <div class="form-group">
            <label for="employeePhone">号码：</label>
            <input type="text" class="form-control" id="employeePhone" name="employeePhone"   placeholder="请输入号码" />
        </div>
        <div class="form-group">
            <label for="employeeAddress">籍贯：</label>
            <input type="text" class="form-control" id="employeeAddress" name="employeeAddress"  placeholder="请输入籍贯" />

        </div>
        <div class="form-group">
            <label for="employeeGrade">职位：</label>
            <select id="employeeGrade" name="employeeGrade" class="form-control">
                <option value="部长">部长</option>
                <option value="成员">成员</option>
            </select>
        </div>
        <div class="form-group">
            <label for="departmentId">部门：</label>
            <select id="departmentId" name="departmentId" class="form-control">
                <%--由下面的Jscript代码进行生成选项--%>
            </select>
        </div>
        <div class="form-group" style="text-align: center">
            <input class="btn btn-primary" type="submit" value="提交" />
            <input class="btn btn-default" type="reset" value="重置" />
            <input class="btn btn-default" id="button" type="button" value="返回"/>
        </div>
    </form>
</div>
</body>
<script>
    $("#button").click(function () {
        location.href= "${pageContext.request.contextPath}/employeewrite.jsp";
    })

    <c:forEach items="${departmentList}" var="department" varStatus="x">
    //1.创建新元素
    var option = document.createElement("option")
    //option添加文本,和属性
    option.innerText="${department.departmentName}"
    option.value="${department.departmentId}"
    //2.将子元素option添加到父类select中
    var select = document.getElementById("departmentId")
    select.appendChild(option);
    </c:forEach>
</script>
</html>